<!--清算账户余额警戒值设置页面-->
<template>
  <div class="app-container">
    <ht-table
      ref="dataTable"
      :showSerialNumber="false"
      :multi-select="false"
      :dictMap="dictMap"
      :reqConfig="reqConfig"
      :queryParams="queryParams"
      :tableBindColumns="tableBindColumns"
      :opButtonList="opButtonList"
      :randomRowKey="true"
    >
      <template v-slot:operate>
        <el-table-column label="操作" align="center" width="120" fixed="right" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <ht-button-group
              :buttonList="[
                {
                  label: '设置',
                  // permission: 'user:xxx:xxx',
                  doFunc: () => {
                    handleAction('setting', scope.row);
                  },
                },
              ]"
            />
          </template>
        </el-table-column>
      </template>
    </ht-table>
    <!-- 设置操作弹出框 -->
    <warning-setting
      ref="warningSettingDialog"
      :dictMap="dictMap"
      :formData.sync="formData"
      @editComplete="editComplete"
    ></warning-setting>
  </div>
</template>
<script>
import { apiUrlConfig } from "@/api/cnaps/nets/AcctLimtWarn/setting_clearing_entry.js";
import WarningSetting from "./components/warningSetting";
import { listPageMixin } from "@/libs/listPageMixin";
import { log } from "util";
import { amountThousandsFormatter } from "@/utils/table_col_formatter";

export default {
  name: "settingClearingEntry",
  mixins: [listPageMixin],
  components: {
    WarningSetting,
  },
  data() {
    return {
      reqConfig: apiUrlConfig,
      total: 0,
      dataList: [],
      //数据字典
      searchFormDictList: ["SWITCHTYPECODE", "PLUSMINUSTYPECODE"],
      //  设置操作弹框数据
      // form表单字段
      formData: {
        bankCode: "",
        stbrname: "",
        clrSwitchType: "",
        clrCurrency: "",
        clrWarnValue: "",
        clrWarnPmFlag: "",
        clrTime: "",
        switchType: "",
        curcd: "",
        warnValue: "",
        warnPmFlag: "",
        remarks: "",
      },
      // 查询参数
      queryParams: {},
      opButtonList: () => {
        return [];
      },
      tableBindColumns: [
        {
          label: `被设置清算行行号`,
          prop: "bankCode",
          width: "300",
          sortable: false,
        },
        {
          label: `被设置清算行行名`,
          prop: "stbrname",
          width: "300",
          sortable: false,
        },
        {
          label: `当前预警开关类型`,
          prop: "clrSwitchType",
          dictCode: "SWITCHTYPECODE",
          sortable: false,
        },
        {
          label: `当前预警金额`,
          prop: "clrWarnValue",
          sortable: false,
          type: "price",
        },

        {
          label: `当前预警正负标志`,
          prop: "clrWarnPmFlag",
          dictCode: "PLUSMINUSTYPECODE",
          sortable: false,
        },
      ],
    };
  },
  mounted() {},
  methods: {
    editComplete(state) {
      if (state == true) {
        this.$refs.dataTable.doQuery();
      }
    },
    handleAction(type, row = {}) {
      switch (type) {
        case "setting":
          // 设置
          this.formData = _.clone(row);
          this.$set(this.formData, "curcd", row.clrCurrency);
          this.$refs.warningSettingDialog.show();
          break;
      }
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}
</style>
